import pygame


class Colleague:
    def __init__(self, name, image_path):
        self.name = name
        self.image = pygame.image.load(image_path)
        self.dialog = ""
        self.dialog_box_rect = pygame.Rect(50, 50, 200, 100)  # 对话框的初始位置和大小

    def set_dialog(self, dialog):
        self.dialog = dialog

    def draw(self, screen):
        screen.blit(self.image, (20, 20))  # 绘制人物头像
        if self.dialog:
            pygame.draw.rect(screen, (255, 255, 255), self.dialog_box_rect)  # 绘制对话框背景
            font = pygame.font.SysFont(None, 24)
            text_surface = font.render(self.dialog, True, (0, 0, 0))
            screen.blit(text_surface, (self.dialog_box_rect.x + 10, self.dialog_box_rect.y + 10))  # 绘制对话内容
